package com.example.servicewallet.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

import java.util.ArrayList;

/**
 * @author my
 * @date 2023/2/8
 * @apiNote
 */
@EnableSwagger2
@Configuration//配置类
public class SwaggerConfig {

    @Bean
    public Docket webApiConfig(){
        return new Docket(DocumentationType.SWAGGER_2)
                .groupName("webApi")
                .apiInfo(webApiInfo())
                .select()
                .apis(RequestHandlerSelectors.withClassAnnotation(RestController.class))
                .paths(PathSelectors.any())
                .build();

    }

    @Bean
    public ApiInfo webApiInfo(){

        return new ApiInfoBuilder()
                .title("网站-用户钱包API文档")
                .description("本文档描述了用户钱包接口定义")
                .version("1.0")
                .contact(new Contact("java", "http://www.baidu.com", "123456@qq.com"))
                .build();
    }

}

